<!--
 * @Descripttion: 
 * @Author: voanit
 * @Date: 2022-06-29 10:53:09
 * @LastEditors: voanit
 * @LastEditTime: 2022-06-29 10:57:19
-->
<template>
  <div>
    御剑乘风来,除魔天地间!===vue3==computed==={{ total }}==={{ total2 }}
  </div>
</template>
<script>
import { ref, computed } from 'vue'
export default {
  name: '',
  setup () {
    /* 
    V2：computed：{
      total:()=>{
        return 
      }
    }
    */
    const arr = ref([1, 2, 3])
    const total = computed(() => {
      return arr.value.reduce((sum, item) => sum + item, 0)
    })
    const total2 = computed(() => {
      return 'total2'
    })
    return { total, total2 }
  }
}
</script>
<style lang='less'  scoped>
</style>